<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: CATExam</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">CATExam</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/classes/cat/cat_exam_rb.html">
                app/classes/cat/cat_exam.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="IRTExam.html">
                IRTExam
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">
    <div id="diagram">
      <map id="map" name="map">
  <area shape="rect" coords="5,101,85,149"      href="CATExam.html" alt="CATExam" />
  <area shape="rect" coords="7,5,84,53"      href="IRTExam.html" alt="IRTExam" />
</map>
<img src="../dot/f_1.png" usemap="#map" border="0" alt="dot/f_1.png">
    </div>

    <div id="description">
      <ul>
<li>cat_exam.rb

</li>
<li>Copyright (C) 2010 Embian Inc.

<p>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
</p>
<p>
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with This program. If not, see &lt;<a
href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/&gt;.
</p>
</li>
<li>Manages items, an <a href="CATExam.html#M000024">examinee</a>

</li>
<li>Author: KyoungMo Yang(E-mail : mo@embian.com)

</li>
<li>Modified: 2010-11-30

</li>
<li>References: <a href="IRTItem.html">IRTItem</a>, <a
href="IRTExam.html">IRTExam</a>

</li>
</ul>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000028">_init</a>&nbsp;&nbsp;
      <a href="#M000022">add_item</a>&nbsp;&nbsp;
      <a href="#M000024">examinee</a>&nbsp;&nbsp;
      <a href="#M000023">examinee=</a>&nbsp;&nbsp;
      <a href="#M000026">get_item</a>&nbsp;&nbsp;
      <a href="#M000027">has_item?</a>&nbsp;&nbsp;
      <a href="#M000025">last_item</a>&nbsp;&nbsp;
      <a href="#M000021">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(user_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Constructs an instance of ItemManager class.
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [user_id] : examinee's id
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * An instance of ItemManager class
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 35</span>
35:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">user_id</span>)
36:     <span class="ruby-keyword kw">super</span>([], [], <span class="ruby-value">1</span>)
37:     <span class="ruby-ivar">@item_map</span> = {}
38:     <span class="ruby-ivar">@user_id</span> = <span class="ruby-identifier">user_id</span>
39:     <span class="ruby-ivar">@last_item</span> = <span class="ruby-keyword kw">nil</span>
40:     <span class="ruby-identifier">_init</span>
41:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">add_item</span><span class="method-args">(cat_item)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Adds item that handled in CAT
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [irt_item] : an instance of IRTItem
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * [irt_item] : added item. if occured error, return nil
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 51</span>
51:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_item</span>(<span class="ruby-identifier">cat_item</span>)
52:     <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Invlaid Parameter : cat_item must be an instance of CATItem class&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">cat_item</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">CATItem</span>
53:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cat_item</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cat_item</span>.<span class="ruby-identifier">iid</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
54:       <span class="ruby-ivar">@items</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">cat_item</span>
55:       <span class="ruby-ivar">@item_map</span>[<span class="ruby-identifier">cat_item</span>.<span class="ruby-identifier">iid</span>.<span class="ruby-identifier">to_i</span>] = <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
56:       
57:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cat_item</span>
58:     <span class="ruby-keyword kw">end</span>
59:     
60:     <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
61:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">examinee</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Returns examinee
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * N/A
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * [cat_examinee] : an instance of CATExaminee
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 84</span>
84:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">examinee</span>
85:     <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@examinees</span>[<span class="ruby-value">0</span>]
86:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">examinee=</span><span class="method-args">(cat_examinee)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Sets examinee
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [cat_examinee] : an instance of CATExaminee
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * N/A
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 71</span>
71:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">examinee=</span>(<span class="ruby-identifier">cat_examinee</span>)
72:     <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Invlaid Parameter : cat_examinee must be an instance of CATExaminee class&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">cat_examinee</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">CATExaminee</span>
73:     <span class="ruby-ivar">@examinees</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">cat_examinee</span>
74:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">get_item</span><span class="method-args">(item_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Returns registered item if the given item's id is present in store.
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [item_id] : item id
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * [irt_item] : Returns registered item if the given id is present in store. Otherwise, returns nil.
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
     <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 108</span>
108:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_item</span>(<span class="ruby-identifier">item_id</span>)
109:     <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@items</span>[<span class="ruby-ivar">@item_map</span>[<span class="ruby-identifier">item_id</span>]]
110:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">has_item?</span><span class="method-args">(obj)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Returns true if the given obj is present in store.
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [obj] : an instance of IRTItem or item's id
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * [result] : Returns true if the given obj is present in store. Otherwise, returns false
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
     <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 120</span>
120:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_item?</span>(<span class="ruby-identifier">obj</span>)
121:     <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">obj</span>
122:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">IRTItem</span>
123:       <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@item_map</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">iid</span>.<span class="ruby-identifier">to_i</span>)
124:     <span class="ruby-keyword kw">end</span>
125:     
126:     <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@item_map</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_i</span>)
127:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">last_item</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * Returns last item
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * [irt_item] : an instance of IRTItem
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * [irt_item] : added item. if occured error, return nil
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 96</span>
96:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last_item</span>
97:     <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">last</span>
98:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Private Instance methods</h3>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">_init</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li>Functionailities

</li>
</ul>
<pre>
 * TODO
</pre>
<ul>
<li>Parameters

</li>
</ul>
<pre>
 * N/A
</pre>
<ul>
<li>Return

</li>
</ul>
<pre>
 * N/A
</pre>
<ul>
<li>Note

</li>
</ul>
<pre>
 * N/A
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
     <span class="ruby-comment cmt"># File app/classes/cat/cat_exam.rb, line 138</span>
138:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_init</span>
139:     <span class="ruby-comment cmt">#TODO : initialize examinee and items</span>
140:     <span class="ruby-ivar">@examinees</span>[<span class="ruby-value">0</span>] = <span class="ruby-constant">CATExaminee</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@user_id</span>, [], <span class="ruby-value str">''</span>, <span class="ruby-value">1</span>)
141:     <span class="ruby-ivar">@items</span> = []
142:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>